package ay.shadow.openfein.listener;

import feign.codec.Decoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.cloud.client.loadbalancer.LoadBalancerClient;
import org.springframework.context.ApplicationContext;
import org.springframework.context.event.EventListener;

/**
 * 调试监听器
 * @author shadow
 */
public class DebugListener {

    @Autowired
    private ApplicationContext applicationContext;

    @EventListener(ApplicationReadyEvent.class)
    public void onApplicationReady() {
        System.out.println("=== 自动装配调试信息 ===");
        
        // 检查所有LoadBalancerClient类型的Bean
        System.out.println("LoadBalancerClient类型的Bean:");
        applicationContext.getBeansOfType(LoadBalancerClient.class).forEach((name, bean) -> {
            System.out.println("  " + name + ": " + bean.getClass().getName());
        });
        
        // 检查所有Decoder类型的Bean
        System.out.println("Decoder类型的Bean:");
        applicationContext.getBeansOfType(Decoder.class).forEach((name, bean) -> {
            System.out.println("  " + name + ": " + bean.getClass().getName());
        });
        
        System.out.println("=== 调试完成 ===");
    }
} 